/*
 * @Descripttion: 护士必须在线的中间件
 * @version: 1.0
 * @Author: 自由如风
 * @Date: 2021-05-05 20:29:35
 * @LastEditors: 自由如风
 * @LastEditTime: 2021-05-06 15:08:37
 */
const { NURSE } = require('../../lib/Identity');
const { Fail } = require('../../lib/Response');

module.exports = async function (ctx, next) {
    if (!!ctx.session.nurse && !!ctx.session.nurse.id && ctx.session.nurse.identity == NURSE) {
        await next();
    } else {
        ctx.body = new Fail('你当前不在线，或身份不是护士。')
    }
}
